<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const userInfo = {
      name : '孙财',
      mobile: '1378882828',
      password: 123456
    }
    const obj = {
      newPassword: '111111'
    }
    // 对象合并 使用的展开运算符
   console.log({...userInfo, ...obj});

  //  将userInfo的password 换成111111
  console.log({...userInfo, password: obj.newPassword});
  //  const arr = [12,3,4,5]
  //  const arr2 = ['a', 'b','c']
  //  console.log(arr.concat(arr2));
  //  console.log([...arr, ...arr2]);

  
  //  浅拷贝处理 数据都是基本类型
  // 递归处理 JSON.parse JSON.stringify() lodash(封装了很多牛的方法) _.deepClone
  const arr = [1, 2, 3, 4, {a: 100}]
  const arr2 = [...arr]
  arr2[4].a = '有人说我帅, 我笑了, 因为我笑起来更帅'
  console.log(arr, arr2);
  </script>
</body>
</html>